package com.me.EpicVN.Utli;

import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.util.Log;

import com.me.EpicVN.Data.NewsDetails;

public class GlobalVariable {
	
	
	public static List<String> listImage;
	public static List<String> listUser = new ArrayList<String>();
	public static List<String> listTitle;
	public static List<String> listTimePost = new ArrayList<String>();
	public static List<NewsDetails> listNews;
	public static final int EXIT_APP = 5;
	
	public static String[] VietnameseSigns = new String[] {

		 "aAeEoOuUiIdDyY",

		 "áàạảãâấầậẩẫăắằặẳẵ",

		 "ÁÀẠẢÃÂẤẦẬẨẪĂẮẰẶẲẴ",

		 "éèẹẻẽêếềệểễ",

		 "ÉÈẸẺẼÊẾỀỆỂỄ",

		 "óòọỏõôốồộổỗơớờợởỡ",

		 "ÓÒỌỎÕÔỐỒỘỔỖƠỚỜỢỞỠ",

		 "úùụủũưứừựửữ",

		 "ÚÙỤỦŨƯỨỪỰỬỮ",

		 "íìịỉĩ",

		 "ÍÌỊỈĨ",

		 "đ",

		 "Đ",

		 "ýỳỵỷỹ",

		 "ÝỲỴỶỸ"

		 };
	static ConnectivityManager connectivityManager;
    static NetworkInfo wifiInfo, mobileInfo;
    static boolean connected = false;
	 public static boolean isOnline(Context con) {
	        try {
	            connectivityManager = (ConnectivityManager) con
	                        .getSystemService(Context.CONNECTIVITY_SERVICE);

	        NetworkInfo networkInfo = connectivityManager.getActiveNetworkInfo();
	        connected = networkInfo != null && networkInfo.isAvailable() &&
	                networkInfo.isConnected();
	        return connected;


	        } catch (Exception e) {
	            System.out.println("CheckConnectivity Exception: " + e.getMessage());
	            Log.v("connectivity", e.toString());
	        }
	        return connected;
	    }
	
    public static Bitmap convertURLtoBitmap(String src) {
        try {
                        URL url = new URL(src);
                        HttpURLConnection connection = (HttpURLConnection) url
                                        .openConnection();
                        connection.setDoInput(true);
                        connection.connect();
                        InputStream input = connection.getInputStream();
                        Bitmap myBitmap = BitmapFactory.decodeStream(input);

                        return myBitmap;

        }

        catch (IOException e) {

                        e.printStackTrace();
                        return null;

        }
}
	

}
